<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="./resources/css/style.css" type="text/css" />
<title>Home</title>
</head>
<body>
	<h1>
		<a href="home.html"><spring:message code="application.name" /></a>
	</h1>

	<form:form modelAttribute="searchCriteria" action="home.html" method="post">
		<table class="silver">
			<tr>
				<td><spring:message code="profile.firstName" /></td>
				<td><form:input path="firstName" size="20" maxlength="50" /></td>
			</tr>
			<tr>
				<td><spring:message code="profile.lastName" /></td>
				<td><form:input path="lastName" size="20" maxlength="50" /></td>
			</tr>
			<tr>
				<td><spring:message code="profile.tittle" /></td>
				<td><form:select path="tittle" multiple="false">
						<form:option value="">--Select--</form:option>
						<c:forEach items="${listTittles}" var="Tt">
							<form:option value="${Tt}">${Tt}</form:option>
						</c:forEach>
					</form:select></td>
			</tr>
			<tr>
				<td><spring:message code="profile.skills" /></td>
				<td><form:select path="skill" multiple="false">
						<form:option value="">--Select--</form:option>
						<c:forEach items="${listSkills}" var="Sk">
							<form:option value="${Sk}">${Sk}</form:option>
						</c:forEach>
					</form:select></td>
			</tr>
			<tr>
				<td></td>
				<td align="right" valign="bottom"><button type="submit"
						name="search">Search</button></td>
			</tr>
		</table>
	</form:form>

	<table>
		<tr>
			<td>
				<table class="silver" width="300">
					<tr>
						<th>ID</th>
						<th><spring:message code="profile.plural" /></th>
						<th><spring:message code="profile.tittle" /></th>
						<th></th>
					</tr>
					<c:forEach items="${profiles}" var="profile">
						<tr>

							<td><a href="profileForm.html?id=${profile.ID}">
									${profile.ID}</a></td>
							<td>${profile.firstName} ${profile.lastName}</td>
							<td>${profile.tittle}</td>
							<td width="20"><form:form name="f${profile.ID}"
									modelAttribute="integer" action="home.html" method="post">
									<input name="id" type="hidden" value="${profile.ID}" />
									<button type="submit" name="delete"
										onclick="return confirm('Are you sure you want to delete?')">
										Delete</button>
								</form:form></td>
						</tr>
					</c:forEach>
				</table>
			</td>
		</tr>
		<tr>
			<td align="right" valign="bottom">
				<button onclick="window.location='profileForm.html'">Add
					Profile</button>
			</td>
		</tr>
	</table>

</body>
</html>
